<?php  

	echo $this->render('global/uploader.phtml'); 
	echo $this->inlineScript()->setScript( '
	var galleryId = ' . $this->g_id . '; ' .
	
	'$(document).ready(function(){
	
		$( "div.img" ).hover(function(){
			$(this).find( "a" ).css({ opacity: 0, display : "block", cursor : "pointer" }).animate({
				opacity : 0.9
			});
		}, function(){
			$(this).find( "a" ).animate({
				opacity : 0
			});
		});
		
		$("#sortable").sortable();
	
	})' .
	
	'');
?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpgaleries/list">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>

<form id="formitem" action="<?php echo $this->baseUrl() ?>/cpgaleries/itemphotos<?php echo isSet( $this->g_id ) ? '/id/' . $this->g_id : '' ?>" method="post" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="6" class="tform">
	<tr>
		<td class="lb">Nazwa PL:</td>
		<td class="inpy">
			<?php if( isSet( $this->err_name ) ) { ?>
				<input style="border:1px solid red;" type="text" name="name" value="" />
				<div class="formerror"><?php echo $this->err_name ?></div>
			<?php } else { ?>
				<input type="text" name="name" value="<?php echo $this->name ?>" />
			<?php } ?>
		</td>
	</tr>
	<tr>
		<td class="inpy" colspan="2">
			<div id="fcont">
				<ul id="sortable">
				<?php foreach( $this->list as $value ) { ?>
				<li class="ui-state-default">
					<div <?php echo ( $value['main'] == 'yes' ) ? 'style="background:#FEFF6F;"' : '' ?> class="img">
						<a style="color:#000" onclick="return confirmDelete();" class="delete" href="<?php echo $this->baseUrl() ?>/cpgaleries/deleteitem/id/<?php echo $value['ph_id'] ?>/g_id/<?php echo $this->g_id ?>">Usuń</a>
						<?php if ( $value['main'] == 'no' ) { ?> 
							<a style="color:#000" class="glowne" href="<?php echo $this->baseUrl() ?>/cpgaleries/setgl/id/<?php echo $value['ph_id'] ?>/g_id/<?php echo $this->g_id ?>">Główne</a>
						<?php } ?>
						<img src="<?php echo $this->File( $value['iden'], 112 ) ?>" />
					</div>

					<div class="desc">
						Opis PL:<br />
						<textarea name="description_pl[<?php echo $value['ph_id'] ?>]"><?php echo $value['description_pl'] ?></textarea>
					</div>

					<div class="desc">
						Opis EN:<br />
						<textarea name="description_en[<?php echo $value['ph_id'] ?>]"><?php echo $value['description_en'] ?></textarea>
					</div>

					<div class="desc">
						Opis CS:<br />
						<textarea name="description_cs[<?php echo $value['ph_id'] ?>]"><?php echo $value['description_cs'] ?></textarea>
					</div>
					<input type="hidden" name="orders[]" value="<?php echo $value['ph_id'] ?>">
				</li>
				<?php } ?>
				</ul>
			</div>
		</td>
	</tr>
	<tr>
		<td class="lb">Dodaj zdjęcia:</td>
		<td class="inpy">
			<div style="clear:both;">
				<div class="fieldset flash" id="fsUploadProgress1">
					<span class="legend"></span>
				</div>
				<div style="padding-left: 5px;">
					<span id="spanButtonPlaceholder1"></span>
					<input id="btnCancel1" type="button" value="Cancel Uploads" onclick="cancelQueue(upload1);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;width:120px;" />
					<br />
				</div>
			</div>
		</td>
	</tr>	
</table>